From a292c99fb50462827fc42625de737bdeade7f1eb Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 19 Apr 1993 20:27:50 +0000 Subject: [PATCH] (set-auto-mode): If the buffer begins with "#!", look for -*- in the first two lines, not just the first one. --- lisp/files.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 5d1b91ce823..3423d87f2ce 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1,6 +1,6 @@ ;;; files.el --- file input and output commands for Emacs -;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc. ;; Maintainer: FSF @@ -694,7 +694,16 @@ If `enable-local-variables' is nil, this function does not check for a (goto-char (point-min)) (skip-chars-forward " \t\n") (if (and enable-local-variables - (search-forward "-*-" (save-excursion (end-of-line) (point)) t) + (search-forward "-*-" (save-excursion + ;; If the file begins with "#!" + ;; (exec interpreter magic), look + ;; for mode frobs in the first two + ;; lines. You cannot necessarily + ;; put them in the first line of + ;; such a file without screwing up + ;; the interpreter invocation. + (end-of-line (and (looking-at "^#!") 2)) + (point)) t) (progn (skip-chars-forward " \t") (setq beg (point)) -- 2.30.2